package haizhi.fruitmall.service.impl;

import haizhi.fruitmall.dao.mapper.UserShopMapper;
import haizhi.fruitmall.pojo.po.UserShop;
import haizhi.fruitmall.pojo.po.UserShopExample;
import haizhi.fruitmall.service.UserShopService;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserShopServiceImpl implements UserShopService {
	@Autowired
	private UserShopMapper userShopMapper;

	@Override
	public void addUserShop(UserShop user_shop) {
		userShopMapper.insertSelective(user_shop);
	}

	@Override
	public UserShop getUserShop(Integer user_id) {
		return userShopMapper.selectByPrimaryKey(user_id);
	}

	@Override
	public List<UserShop> getUserShops(String shop_id) {
		UserShopExample userShopExample = new UserShopExample();
		UserShopExample.Criteria criteria = userShopExample.createCriteria();
		criteria.andShopIdEqualTo(shop_id);
		return userShopMapper.selectByExample(userShopExample);
	}

}
